package com.winit.cloudlink.demo.core.tms;

import com.winit.cloudlink.command.Command;
import com.winit.cloudlink.command.CommandCallback;
import com.winit.cloudlink.common.Shardable;
import com.winit.cloudlink.demo.core.PickupInfo;
import com.winit.cloudlink.demo.core.PickupReturnValue;

/**
 * Created by jianke.zhang on 2017/8/27.
 */
public class PickupCallback implements CommandCallback<Command<PickupReturnValue>>, Shardable {

    @Override public String getCommandName() {
        return PickupInfo.COMMAND_NAME;
    }

    @Override public void onCallback(Command<PickupReturnValue> callbackCommand) {
        System.out.println(">>>>>>>>>>>>>>>>>>>execute commnadExecutor");
        PickupReturnValue pickupInfo = callbackCommand.getPayload();

        System.out.println(">>>>>>>>>>>>>>>>>>>paramter[area] : " + pickupInfo.getDesc());

        PickupReturnValue returnValue = new PickupReturnValue();
        returnValue.setCode("10000001");
        returnValue.setDesc("操作完成, from " + pickupInfo.getDesc());
    }

    @Override public String[] getShardKeys() {
        return new String[]{"SZX","SHA"};
    }
}
